package office;

import java.text.Collator;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;

/**
 * @Author: youdao.hww
 * @Date: 8/15/24
 * @Desc:
 */
public class Test {

    public static void main(String[] args) {

        Patient patient1 = new Patient();
        patient1.setGroupName("责任一");
        patient1.setBedNo("1");
        patient1.setBedSortNumber(1);

        Patient patient2 = new Patient();
        patient2.setGroupName("责任一");
        patient2.setBedNo("13");
        patient2.setBedSortNumber(4);



        Patient patient3 = new Patient();
        patient3.setGroupName("责任一");
        patient3.setBedNo("10");
        patient3.setBedSortNumber(3);


        Patient patient4 = new Patient();
        patient4.setGroupName("责任一");
        patient4.setBedNo("4");
        patient4.setBedSortNumber(2);



        Patient patient5 = new Patient();
        patient5.setGroupName("责任二");
        patient5.setBedNo("1");
        patient5.setBedSortNumber(5);

        Patient patient6 = new Patient();
        patient6.setGroupName("责任二");
        patient6.setBedNo("13");
        patient6.setBedSortNumber(8);

        Patient patient7 = new Patient();
        patient7.setGroupName("责任二");
        patient7.setBedNo("10");
        patient7.setBedSortNumber(7);


        Patient patient8 = new Patient();
        patient8.setGroupName("责任二");
        patient8.setBedNo("4");
        patient8.setBedSortNumber(6);


        Patient patient9 = new Patient();
        patient9.setGroupName("责任三");
        patient9.setBedNo("2");
        patient9.setBedSortNumber(1);

        List<Patient> newNurseGroupWithPatientDTOList=Arrays.asList(patient9,patient1,patient2,patient3,patient4,patient5,patient6,patient7,patient8);

//        newNurseGroupWithPatientDTOList.sort(Comparator.comparing(Patient::getGroupName, Comparator.nullsLast(String::compareTo))
//                .thenComparing(Patient::getBedSortNumber, Comparator.nullsLast(Integer::compareTo)));


        List<Patient> collect = newNurseGroupWithPatientDTOList.stream().sorted((i1, i2) -> Collator.getInstance(Locale.CHINESE).compare(i1.getGroupName(), i2.getGroupName())).collect(Collectors.toList());

        System.out.println("collect = " + collect);

    }

}
